package observer;/** * Created by Administrator on 2018-10-18. * 构建一个布告板 */public class CurrentConditionsDisplay implements Observer, DisplayElement {    private float temperature;    private float humidity;    private float pressure;    private Subject weatherData;    public CurrentConditionsDisplay(Subject weatherData) {        this.weatherData = weatherData;        weatherData.regiserObserver(this);    }    public void update(float temp, float humidity, float pressure) {        this.temperature = temp;        this.humidity = humidity;        this.pressure = pressure;        display();    }    public void display() {        System.out.println("当前温度:" + temperature + "湿度:" + humidity + "%" + "气压:" + pressure);    }}